package com.westos.echufang.config.handler;

import org.springframework.web.servlet.HandlerInterceptor;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class MailCheckIntercepter implements HandlerInterceptor {

    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
        Object code = request.getSession().getAttribute("checked");
        if (code==null){
            request.setAttribute("codeCheck","请输入验证码");
            request.getRequestDispatcher("/mailVerification").forward(request,response);
            return false;
        }else
            return true;
    }
}
